<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:65:"E:\WWW\movie.cc\public/../application/admin\view\index\index.html";i:1688634472;}*/ ?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>主页</title>
    <!-- 依 赖 样 式 -->
    <link rel="stylesheet" href="/static/component/pear/css/pear.css" />
    <!-- 加 载 样 式-->
    <link rel="stylesheet" href="/static/admin/css/loader.css" />
    <!-- 布 局 样 式 -->
    <link rel="stylesheet" href="/static/admin/css/admin.css" />
        <script>
            if(window!=top){ top.location.href = location.href; }
        </script>
  </head>
  <!-- 结 构 代 码 -->
  <body class="layui-layout-body pear-admin">
    <!-- 布 局 框 架 -->
    <div class="layui-layout layui-layout-admin">
      <div class="layui-header">
        <!-- 顶 部 左 侧 功 能 -->
        <ul class="layui-nav layui-layout-left">
          <li class="collaspe layui-nav-item"><a href="#" class="layui-icon layui-icon-shrink-right"></a></li>
          <li class="refresh layui-nav-item"><a href="#" class="layui-icon layui-icon-refresh-1" loading=600></a></li>
        </ul>
        <!-- 顶 部 右 侧 菜 单 -->
        <div id="control" class="layui-layout-control"></div>
        <ul class="layui-nav layui-layout-right" lay-filter="layui_nav_right">
          <li class="layui-nav-item layui-hide-xs"><a href="#" class="fullScreen layui-icon layui-icon-screen-full"></a></li>
          <!-- <li class="layui-nav-item layui-hide-xs"><a href="http://www.pearadmin.com" class="layui-icon layui-icon-website"></a></li> -->
                    <li class="layui-nav-item user">
            <!-- 头 像 -->
            <a href="javascript:;">
              <img src="/static/admin/images/avatar.jpg" class="layui-nav-img">
              <?php echo $admin['adminname']; ?>
            </a>
            <!-- 功 能 菜 单 -->
                        <dl class="layui-nav-child">
                            <dd>
                                <a href="javascript:void(0);" class="password">
                                    修改密码
                                </a>
                            </dd>
                         <!--    <dd>
                                <a href="javascript:void(0);" class="cache">
                                    清理缓存
                                </a>
                            </dd> -->
                            <dd>
                                <a href="javascript:void(0);" class="logout">
                                    退出登录
                                </a>
                            </dd>
                        </dl>
          </li>
          <!-- 主 题 配 置 -->
          <li class="layui-nav-item setting"><a href="#" class="layui-icon layui-icon-more-vertical"></a></li>
        </ul>
      </div>
      <!-- 侧 边 区 域 -->
      <div class="layui-side layui-bg-black">
        <!-- 顶 部 图 标 -->
        <div class="layui-logo">
          <!-- 图 表 -->
          <img class="logo"></img>
          <!-- 标 题 -->
          <span class="title" style="cursor: pointer;" onclick="location.href=`<?php echo url('/admin/index'); ?>`"><?php echo $xitong['webname']; ?></span>
        </div>
        <!-- 侧 边 菜 单 -->
        <div class="layui-side-scroll">
          <div id="sideMenu"></div>
        </div>
      </div>
      <!-- 视 图 页 面 -->
      <div class="layui-body">
        <!-- 内 容 页 面 -->
        <div id="content"></div>
      </div>
    </div>
    <!-- 遮 盖 层 -->
    <div class="pear-cover"></div>
    <!-- 移 动 端 便 捷 操 作 -->
    <div class="pear-collasped-pe collaspe"><a href="#" class="layui-icon layui-icon-shrink-right"></a></div>
    <!-- 加 载 动 画-->
    <div class="loader-main">
      <div class="loader"></div>
    </div>
    <!-- 依 赖 脚 本 -->
    <script src="/static/component/layui/layui.js"></script>
    <script src="/static/component/pear/pear.js"></script>
    <!-- 框 架 初 始 化 -->
    <script>
        layui.use(['admin', 'jquery', 'layer','element'], function() {
            var $ = layui.jquery;
            var layer = layui.layer;
            var layelem = layui.element;
            var admin = layui.admin;
            admin.setConfigType("json");
            admin.setConfigPath("/static/config/pear.config.json?v=<?php echo time(); ?>");
        
            admin.render();
            layelem.on('nav(layui_nav_right)', function(elem) {
                if ($(elem).hasClass('logout')) {
                    layer.confirm('确定退出登录吗?', function(index) {
                        layer.close(index);
                         location.href = '<?php echo \think\Request::instance()->root(); ?>/admin/admin/loginout';
                        // $.ajax({
                        //     url: '<?php echo \think\Request::instance()->root(); ?>/admin/admin/loginout',
                        //     type:"POST",
                        //     dataType:"json",
                        //     success: function(res) {
                        //         if (res.code==200) {
                        //             layer.msg(res.msg, {
                        //                 icon: 1
                        //             });
                        //             setTimeout(function() {
                        //                 location.href = '<?php echo \think\Request::instance()->root(); ?>/admin/admin/login';
                        //             }, 333)
                        //         }
                        //     }
                        // });
                    });
                }else if ($(elem).hasClass('password')) {
                    layer.open({
            type: 2
            ,title: '修改密码'
            ,content: "<?php echo url('/admin/admin/pass'); ?>?id=<?php echo $admin['id']; ?>"
            ,maxmin: true
            ,area: ['50%', '80%']
            ,btn: ['确定', '取消']
            ,yes: function(index, layero){
              var iframeWindow = window['layui-layer-iframe'+ index]
              ,submitID = 'LAY-user-front-submit'
              ,submit = layero.find('iframe').contents().find('#'+ submitID);

              //监听提交
              iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
                var field = data.field; //获取提交的字段
                
                //提交 Ajax 成功后，静态更新表格中的数据
                $.ajax({
                   type: "POST",
                   url: "<?php echo url('/admin/admin/xiu_pass'); ?>?id=<?php echo $admin['id']; ?>",
                   data: field,
                   success: function(msg){
                     // alert( "Data Saved: " + msg );
                     if(msg==1){
                        layer.msg('修改成功', {
                          offset: '15px'
                          ,icon: 1
                          ,time: 1000
                        });
                    layer.close(index); //关闭弹层
                     }else if(msg==3){
                      layer.msg('两次密码输入不一致', {
                        offset: '15px'
                        ,icon: 2
                        ,time: 1000
                      });
                     }else{
                      layer.msg('修改失败,新旧密码一致', {
                        offset: '15px'
                        ,icon: 2
                        ,time: 1000
                      });
                     }
                   }
                });
                //table.reload('LAY-user-front-submit'); //数据刷新
                table.reload('dataTable', {
                  where: field
                  ,url:'<?php echo url('/admin/admin/lst'); ?>'
                  ,contentType: 'application/json'
                  ,page: true
                });

              });  
              
              submit.trigger('click');
            }
            ,success: function(layero, index){
              
            }
          });
                }else if ($(elem).hasClass('cache')) {
                    $.post('<?php echo \think\Request::instance()->root(); ?>/index/cache',
                    function(data){
                        layer.msg(data.msg, {time: 1500});
                        location.reload()
                    });

                }

            });
        })
    </script>
  </body>
</html>
